\section{network::connection\_\-listener Class Reference}
\label{classnetwork_1_1connection__listener}\index{network::connection_listener@{network::connection\_\-listener}}
this class provides a server-socket functionality.  


{\tt \#include $<$connection\_\-listener.h$>$}

Inheritance diagram for network::connection\_\-listener::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3cm]{classnetwork_1_1connection__listener}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\bf{connection\_\-listener} (boost::shared\_\-ptr$<$ \bf{network::tcp\_\-socket} $>$ sock, boost::shared\_\-ptr$<$ \bf{network::message\_\-queue} $>$ q)
\begin{CompactList}\small\item\em \doxyref{connection\_\-listener}{p.}{classnetwork_1_1connection__listener} is the constructor for the \doxyref{connection\_\-listener}{p.}{classnetwork_1_1connection__listener} class. \item\end{CompactList}\item 
virtual \bf{$\sim$connection\_\-listener} ()\label{classnetwork_1_1connection__listener_8ca577bb4f43cf58d84cc2b39d01352c}

\item 
virtual void \bf{run} ()
\begin{CompactList}\small\item\em run runs the thread. Don't call this method, and use \doxyref{start\_\-thread()}{p.}{classnetwork_1_1worker__thread_79edd8c46081c1761ae00e8c00519554} instead. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
this class provides a server-socket functionality. 

This class provides a server-socket functionality. It runs as a thread and listenes to a specific tcp-port. If a connection is established it is inserted in the message\_\-queue, with the established socket. 



Definition at line 41 of file connection\_\-listener.h.

\subsection{Constructor \& Destructor Documentation}
\index{network::connection_listener@{network::connection\_\-listener}!connection_listener@{connection\_\-listener}}
\index{connection_listener@{connection\_\-listener}!network::connection_listener@{network::connection\_\-listener}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}network::connection\_\-listener::connection\_\-listener (boost::shared\_\-ptr$<$ \bf{network::tcp\_\-socket} $>$ {\em sock}, boost::shared\_\-ptr$<$ \bf{network::message\_\-queue} $>$ {\em q})\hspace{0.3cm}{\tt  [inline]}}\label{classnetwork_1_1connection__listener_acb0db219d4415e7971eeecd860686c8}


\doxyref{connection\_\-listener}{p.}{classnetwork_1_1connection__listener} is the constructor for the \doxyref{connection\_\-listener}{p.}{classnetwork_1_1connection__listener} class. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sock}]is the socket from which \doxyref{connection\_\-listener}{p.}{classnetwork_1_1connection__listener} should listen. \item[{\em q}]is the message\_\-queue into which the \doxyref{connection\_\-listener}{p.}{classnetwork_1_1connection__listener} should insert his messages. \end{description}
\end{Desc}


Definition at line 52 of file connection\_\-listener.h.

\begin{Code}\begin{verbatim}54                 : _sock(sock), _queue(q) {}
\end{verbatim}\end{Code}




\subsection{Member Function Documentation}
\index{network::connection_listener@{network::connection\_\-listener}!run@{run}}
\index{run@{run}!network::connection_listener@{network::connection\_\-listener}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void network::connection\_\-listener::run ()\hspace{0.3cm}{\tt  [virtual]}}\label{classnetwork_1_1connection__listener_d4ba35fb39ad8d544cf967f3ed8d27d3}


run runs the thread. Don't call this method, and use \doxyref{start\_\-thread()}{p.}{classnetwork_1_1worker__thread_79edd8c46081c1761ae00e8c00519554} instead. 

\begin{Desc}
\item[See also:]\doxyref{network::worker\_\-thread}{p.}{classnetwork_1_1worker__thread} \end{Desc}


Implements \bf{network::worker\_\-thread} \doxyref{p.}{classnetwork_1_1worker__thread_c2671b608908a5fb42d09317efb931dd}.

Definition at line 7 of file connection\_\-listener.cpp.

\begin{Code}\begin{verbatim}8 {
9         _sock->listen();
10         while(1) {
11                 if(is_interrupted()) {
12                         return;
13                 }
14                 boost::shared_ptr<network::tcp_socket> tmp(
15                         new network::tcp_socket());
16                 if(_sock->accept(*tmp)) {
17                         boost::shared_ptr<network::message> msg(
18                                 new network::message);
19                         msg->sock = _sock;
20                         msg->node = boost::shared_ptr<model::dom>();
21                         msg->type = network::CONNECT;
22                         msg->new_sock = tmp;
23 
24                         _queue->put(msg);
25                 }
26         }
27 }
\end{verbatim}\end{Code}




The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
network/connection\_\-listener.h\item 
network/connection\_\-listener.cpp\end{CompactItemize}
